package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.base.BasePresenter;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalIdentificationModel;
import com.beiing.tianshuai.tianshuai.mine.model.PersonalIdentificationModelImpl;
import com.beiing.tianshuai.tianshuai.mine.view.PersonalIdentificationViewImpl;

import java.io.File;
import java.util.List;

import okhttp3.ResponseBody;

/**
 * Created by Jinni on 2017/8/21 0021.
 */

public class PersonalIdentificationPresenter extends BasePresenter implements PersonalIdentificationPresenterImpl, PersonalIdentificationModel.OnRequestListener {

    private PersonalIdentificationModelImpl mModel;
    private PersonalIdentificationViewImpl mView;

    public PersonalIdentificationPresenter(PersonalIdentificationViewImpl view) {
        mView = view;
        mModel = new PersonalIdentificationModel(this);
    }

    @Override
    public void getSubmitIdentificationResult(String uid, String name, String tel, List<File> images) {
        mView.showProgress();
        mModel.getSubmitIdentificationResult(uid, name, tel, images);
    }

    @Override
    public void onSuccess(ResponseBody bean) {
        mView.hideProgress();
        mView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mView.hideProgress();
        mView.onRequestFailed(throwable);
    }
}
